<template>
  <div class="dialog_container">
    <div class="dialog">
      <div class="title_box">
        <div>预览pdf</div>
        <img @click="closeDialog" src="@/assets/common/close.png">
      </div>
      <div class="pdf-viewer-container">
        <iframe
          frameborder="0"
          :src="pdfUrl"
          style="width: 300px; height: 300px;"
        ></iframe>

      </div>
    </div>
    <div class="mask"></div>
  </div>
</template>

<script setup>
import {ref} from 'vue';


// 定义要触发的事件
const emit = defineEmits(['close']);

//处理传进来的pdf url数据
const props = defineProps({
  //pdfUrl
  pdfUrl: {
    type: String,
    default: null,
  }
});



// 触发关闭事件
function closeDialog() {
  emit('close');
}
</script>

<style scoped lang="scss">
.login_dialog_container {
  padding: 24px;
  background-color: #fff;
  border-radius: 24px;
}

.dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  z-index: 20;
  padding: 24px;
  border-radius: 24px;
  .title_box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 24px;
    font-weight: bold;
    line-height: 32px;
    color: #1C1E24;

    img {
      width: 24px;
      height: 24px;
    }
  }
  .pdf-viewer-container {
    position: relative;

    /* 禁用右键菜单 */
    -webkit-touch-callout: none;
    user-select: none;
  }
}

.mask {
  position: fixed;
  left: 0;
  top: 0;
  background-color: rgba(0, 0, 0, .4);
  width: 100%;
  height: 100%;
  z-index: 10;
}
</style>
